<%@page import="java.util.List"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html>
<%@ include file="/WEB-INF/view-system/include/myTaglib.jsp"%>

<html>
<head>
	<title>员工信息页面</title>
	<script src="${ctxStaticSystem }/js/staff/staff.js" type="text/javascript" ></script>
	<script src="${ctxStaticSystem }/js/staff/staffRoles.js" type="text/javascript" ></script>
	<link href="${ctx}/static-system/css/staff/staff.css" rel="stylesheet" type="text/css"/>
	<link href="${ctxStaticSystem }/css/knowledge/manage/knowledge.css" rel="stylesheet" type="text/css"/>
</head> 
<body>
	<!-- 修改页面dialog -->
	<script src="${ctxStaticSystem }/js/staff/staff.js" type="text/javascript" ></script>
	<script src="${ctxStaticSystem }/js/staff/staffRoles.js" type="text/javascript" ></script>
		<!-- 角色表查询 -->
		<tags:ajax id="queryRoleInfoListAjax"
			url="${ctx }/sys/roleMgr/roleList" autoSend='false' type='post'
			formSubmit="true" formQuery="#roleOldInfoFrm"
			onSuccess="onQueryRoleInfoListSucc"/>
		<!-- 查询员工角色 -->
		<tags:ajax id="findStaffRolesAjax" url="${ctx }/sys/staffMgr/findRolesByUserId"
			autoSend="false" type="post" contentType="application/x-www-form-urlencoded"
			onSuccess="onFindStaffRoleSucc"/>
		<!-- 保存员工角色 -->
		<tags:ajax id="saveStaffRolesAjax" url="${ctx }/sys/staffMgr/editStaffInfoAndRoles"
			autoSend="false" type="post" formQuery="#staffBaseInfoFrm" formSubmit="true"
			onSuccess="onSaveSucc"/>
		<tags:dataSet id="roleInfoSet">
			<tags:dataField sort="false" name="roleId" display="" visiable="false" cssClass="table-header-center"/>
			<tags:dataField sort="false" name="roleName" display="角色名称" cssClass="table-header-center"/>
			<tags:dataField sort="false" name="state" display="状态" cssClass="table-header-center"/>
			<tags:dataField sort="false" name="roleType" display="操作" cssClass="table-header-center"/>
		</tags:dataSet>
			<div class="baseInfoDiv">
				<form id="staffBaseInfoFrm">
					<input id="staffIdByRoles" name="staffId" style="display:none" value="${requestScope.sysStaffVO.staffId }">
					<input name="roleIds" id="staffHasRoles" style="display:none">
					<div class="col-md-4">
						<span>员工姓名:</span>
						<input name="staffName" class="disInput" readonly="readonly" value="${requestScope.sysStaffVO.staffName }">
					</div>
				</form>
			</div>
			<div class="hasRolesDiv">
				<form action="" id="hasRolesFrm">
					<fieldset>
						<legend>已拥有角色</legend>
						<div class="rolesShowDiv">
						
						</div>
					</fieldset>
				</form>
			</div>
			<div>
				<form action="" id="roleOldInfoFrm">
					<fieldset>
						<legend>所有角色</legend>
						<div class="input-group col-md-4 searDiv">
							<input type="text" name="roleName" class="form-control" placeholder="角色名称">
			  				<span class="input-group-btn">
							    <button class="btn btn-primary m-btn" type="button" onclick="searchName()">搜索</button>
							</span>
						</div>
						<div>
							<tags:datatable id="staffRoleDatatable" storage="false"
								ajax="queryRoleInfoListAjax" pagination="roleMananagePagination"
								dataSet="roleInfoSet"
								striped="true" cutLine="true"
								onRenderItem="tableO.onRoleRenderItem"
								afterReady="tableO.onAfterReady"/>
							<tags:pagination pageSize="5" id="roleMananagePagination" 
								pageChoice="5" datatable="staffRoleDatatable" />
						</div>
					</fieldset>
				</form>
		 	</div>
			<div style="text-align: center;">
				<button class="btn btn-primary m-btn" id="saveChanges" onclick="saveAll()">提交</button>
				<button class="btn btn-default m-btn" id="closeDia" onclick="closeDia()">关闭</button>
			</div>
</body>
	
</html>